class Solution(object):
    def countHomogenous(self, s):
        n = len(s)
        left = 0
        right = 0
        ans = 0
        base = 10 ** 9 + 7
        while right < n:
            if s[right] == s[left]:
                ans += right - left + 1
                right += 1
            else:
                left = right
        return ans % base
